package com.rpc.demo.registry;

import com.rpc.demo.pojo.URL;

import java.util.HashMap;
import java.util.Map;

public class NativeRegistry {

	//注册中心
	private static Map<String,Map<URL,Class>> registCenter = new HashMap<>();

	/**
	 * 注册服务的方法
	 */
	public static void register(String interfaceName,URL url,Class implClass){
		Map<URL,Class> map = new HashMap<>();
		map.put(url,implClass);
		registCenter.put(interfaceName,map);
	}

	/**
	 * 获取服务的方法
	 */
	public static Class get(String interfaceName,URL url){
		Map<URL, Class> urlClassMap = registCenter.get(interfaceName);
		return urlClassMap.get(url);
	}

}
